import axios from 'axios'

export const countDesc = {
  type: 'countDesc',
  payload: 100
}

export const changeCount = (payload) => {
  return {
    type: 'changeCount',
    payload,
  }
}

export const changeCity = (payload) => {
  return {
    type: 'changeCity',
    payload
  }
}

export const changeWord = (payload) => {
  return {
    type: 'changeWord',
    payload
  }
}

export const changeFlag = (payload) => {
  return {
    type: 'changeFlag',
    payload
  }
}

export const changeMsg = (payload) => {
  return {
    type: 'changeMsg',
    payload
  }
}

export const changeDataTestAsync = async (payload) => {
  const res = await axios.get('http://81.69.235.62:3000/api/test')
  return {
    type: 'changeDataTestAsync',
    payload: res.data.msg
  }
}

export const changeDataListAsync = async (payload) => {
  const res = await axios.get('http://81.69.235.62:3000/api/goodlist')
  return {
    type: 'changeDataListAsync',
    payload: res.data.result
  }
}
